package com.hyt.it.ogt.kq.service.bm.mq;

import com.hyt.core.util.FastJsonUtil;
import com.hyt.it.ogt.kq.common.config.ConfigManager;
import com.hyt.it.ogt.kq.service.bm.model.param.GroupRegistrationExamineeInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 集体报名创建同步创建账号消息生产者
 *
 * @author huangwu
 * @date 2022-09-05
 */
@Component
@Slf4j
public class GroupRegistrationDataProducer {

	@Resource
    private ConfigManager configManager;
    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendMessage(GroupRegistrationExamineeInfo groupRegistrationExamineeInfo) {
    	
    	log.info("[集体报名][创建账号][MQ发送消息] createUser examineeInfo push mqmsg start :{}", FastJsonUtil.getBeanToJson(groupRegistrationExamineeInfo));
		// 推送一个消息
		rabbitTemplate.convertAndSend(configManager.getDirect(), configManager.getGroupRegistrationRoute(), FastJsonUtil.getBeanToJson(groupRegistrationExamineeInfo));
		
		log.info("[集体报名][创建账号][MQ发送消息] createUser examineeInfo push mqmsg success");
    }

}
